seed
Numbers Random TimM Revised

Controlling Random Number Generation

Problem
=======

When doing any testing or simulation using any code that generates random numbers,
it is important to be able to reproduce the sequence of "random" choices that lead
to a particular result. This is useful when, say, trying to debug some crash.

Solution
========

Define a global _Seed_ that is to be used to seed the random number generator.
Also, write a _seed(n)_ function that can reset that
seed to a locally set value.

 function seed( seed0) {
      seed0 = seed0 ? seed0 : systime() + PROCINFO["pid"]
      srand(Seed ? Seed : seed0)
 }

Notes
=====

The above code can be called two ways:

+  _seed(1)_ to change the seed to something you can control (in this case, 1);
+  _seed()_ to select some random seed.

Author
======

Tim Menzies

